$(document).ready(function(){
			
	myInfo();
	
	$("#btn-form").click(function(){
		$("#row-from").slideToggle();
	});
	
	$("#one-submit").click(function(){
		var old_pwd = $("*[name='old-password']").val();
		var new_pwd = $("*[name='new-password']").val();
		var re_pwd = $("*[name='ne-password']").val();
		
		if ($("*[name='new-password']").val()!=$("*[name='ne-password']").val()) {
			alert("两次密码不相同");
		}else{
			$.ajax({
				type:"get",
				url:"/ldss/user/updatepwd",
				data:{
					old_pwd:md5(old_pwd),
					new_pwd:md5(new_pwd),
					re_pwd:md5(re_pwd)
				},
				dataType:"json",
				async:false,
				success: function (data) {
					if(data.success){
						window.location.href="/ldss/ldss/login";
					}else{
						alert(data.message);
					}
				},
				error: function(){
					alert("请求出错");
				}
			});
		}
		
	});
})

function myInfo(){
	$.ajax({
		type:"get",
		url:"/ldss/user/myinfo",
		dataType:"json",
		async:false,
		success: function (data) {
			if(data.success){
				var data = data.data;
				$("#username").empty();
				$("#username").append(data.username);
				
				$("#usertel").empty();
				$("#usertel").append(data.usertel);
				
				$("#userIDcard").empty();
				$("#userIDcard").append(data.userIDcard);
			}else{
				alert(data.message);
			}
		},
		error: function(){
			alert("请求出错");
		}
	});
}